//
//  ViewController.m
//  UI28-(AutoLayoutAnimation)
//
//  Created by 韩旭 on 16/8/22.
//  Copyright © 2016年 HX_. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()
@end

@implementation ViewController
- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    //    回复原样
    [UIView animateWithDuration:1 animations:^{
        
        
        self.imageLagou.transform = CGAffineTransformIdentity;
    }];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.imageLagou.transform = CGAffineTransformMakeTranslation(-300, 0);
   
}
- (IBAction)startAnimation:(id)sender {
    //    改变centery的constant
    self.centerx.constant = 200;
    // 执行动画效果
    //    [UIView animateWithDuration:3 animations:^{
    //        必须调用
    //        [self.view layoutIfNeeded];
    //    }];
//    约束的优先级，改变时，需要注意不能为1000， 程序会崩溃
//    同一约束，优先级高的会被执行，优先级低的会被忽略, 改变的时候不能是1000
    self.width.constant = self.view.bounds.size.width;
    
    self.layoutLeft.priority = 751;
    self.layout150.priority = 750;
//    [UIView animateWithDuration:1 animations:^{
//        [self.view layoutIfNeeded];
//    }];
    [UIView animateWithDuration:2 delay:0 usingSpringWithDamping:0.1 initialSpringVelocity:12 options:UIViewAnimationOptionRepeat animations:^{
        [self.view layoutIfNeeded];
    } completion:^(BOOL finished) {
        
        
    }];

    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
